import 'package:flutter/material.dart';
import 'package:fzcgx_app/ui/my/factory/model/factory_product_category_model.dart';

class SelectFactoryProducts2Model {
  String id;
  String name;
  String pid;
  bool isInput = false;
  TextEditingController nameController = TextEditingController();
  List<FactoryProductCategoryModel> childs;

  SelectFactoryProducts2Model({
    this.id,
    this.name,
    this.pid,
  });

  SelectFactoryProducts2Model.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    name = json['name'];
    pid = json['pid'];
    if (json['childs'] != null) {
      childs = new List<FactoryProductCategoryModel>();
      json['childs'].forEach((v) {
        childs.add(FactoryProductCategoryModel.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['name'] = this.name;
    data['pid'] = this.pid;
    if (this.childs != null) {
      data['childs'] = this.childs.map((v) => v.toJson()).toList();
    }
    return data;
  }
}
